const key = 'cookie'

const setCookieToStorage = (data) => my.setStorageSync({
	key,
	data
})
const getCookieFromStorage = () =>  my.getStorageSync({key})

//手机端不是个列表，电脑端是个列表
const getSessionIdFromResponse = (res) => {
	//这居然是个对象...
	//console.log(res)
	// console.log(res.headers)
	console.log(res.headers['set-cookie'])
	console.log(typeof res.headers['set-cookie'])
	if (res.headers['set-cookie'] instanceof Object) {
		console.log(res.headers['set-cookie'][0])
		return res.headers['set-cookie'][0]
	}
	/*if (res.headers['set-cookie'].length) {
		return res.headers['set-cookie'][0]
	}*/
	return res.headers['set-cookie']
}

module.exports = {
	setCookieToStorage,
	getCookieFromStorage,
	getSessionIdFromResponse
}